package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.request.UsersBalanceRecordRequest;
import com.ytjj.qmyx.admin.service.UsersBalanceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/balanceRecord")
public class UsersBalanceRecordController {

    @Autowired
    private UsersBalanceRecordService usersBalanceRecordService;

    /**
     * 添加增加用户余额记录
     * @param usersBalanceRecordRequest
     * @return
     */
    @PostMapping("/insert")
    public CommonResult insert(@RequestBody UsersBalanceRecordRequest usersBalanceRecordRequest){
        int count = usersBalanceRecordService.insertRecord(usersBalanceRecordRequest);
        if (count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }

}
